package com.ktgj.customer.controller;

import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.web.page.TableDataInfo;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.annotation.SignatureValidation;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.customer.domain.Bank;
import com.ktgj.customer.domain.BankCard;
import com.ktgj.customer.domain.Customer;
import com.ktgj.customer.domain.vo.BankCardVo;
import com.ktgj.customer.domain.vo.BankCareDto;
import com.ktgj.customer.domain.vo.BankVo;
import com.ktgj.customer.service.IBankCardService;
import com.ktgj.customer.service.IBankService;
import com.ktgj.customer.service.ILoginService;
import com.ktgj.customer.util.CheckBankCard;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * 银行卡信息Controller
 * 
 * @author ruoyi
 * @date 2021-09-01
 */
@ControllerAdvice
@RestController
@RequestMapping("/bank")
public class BankController extends BaseController
{
    @Autowired
    private IBankService bankService;

    /**
     * 远程-银行名称模糊查询
     * */
    @PostMapping("/selectBankLike")
    public String selectBankLike(@RequestBody Map<String, Object> map){
        if (map.get("bankName") != null && !map.get("bankName").equals("")){
            String bankName = map.get("bankName").toString();
            Bank bank = bankService.selectBankLike(bankName);
            if (bank != null){
                return bank.getBankCode();
            }
            else {
                return null;
            }
        }
        else {
            return null;
        }
    }

    /**
     * 开户行列表
     * */
    @PostMapping("/selectbank")
    public AjaxResult selectbank() {
        List<Bank> selectbank = bankService.selectbank();
        return AjaxResult.success(selectbank);
    }
}
